/**
 * 
 */
package com.googlecode.gauth.factory;

import com.googlecode.gauth.beans.User;
import com.googlecode.gauth.service.UserService;
import com.googlecode.gauth.service.impl.UserServiceImpl;

/**
 * @author asanthan
 * 
 */
public class UserServiceFactory {

	private static final UserService userService = new UserServiceImpl();

	/**
	 * TODO: Move admin user's info to separate class.
	 */
	private static final String[] admins = { "aravinds@gmail.com", "harshan@gmail.com" };

	private UserServiceFactory() {
	}

	public static UserService createUserService() {
		return userService;
	}

	public static boolean isAdmin(User pUser) {
		if (pUser != null) {
			String email = pUser.getEmail();
			if (email != null) {
				for (String str : admins) {
					if (str.equals(email)) {
						return true;
					}
				}
			}
		}
		return false;
	}
}
